import time

def bubble_sort(arr: list):
    n = len(arr) - 1
    for i in range(0, n):
        for j in range(0, n - i):
            if arr[j] > arr[j + 1]:
                arr[j], arr[j + 1] = arr[j + 1], arr[j]
    return arr

def measure_sort(fname: str):
    arr = []
    f = open(fname)
    for line in f.readlines():
        arr.append(int(line))
    f.close()
    start = time.time()
    arr = bubble_sort(arr)
    end = time.time()
    print(fname, int((end - start) * 1000), "milliseconds")

measure_sort("m1_sorted.txt")
measure_sort("m2_reverse.txt")
measure_sort("m3_shuffle.txt")
